import request from '@/plugins/axios'


//分页查询
export function queryPage(query){
    return request({
        url: '/api/roominfo/page',
        method: 'get',
        params: query
    })
}
export function get(roomId) {
    return request.get("/api/roominfo/"+roomId)
}

//初始化列表
export  function initTreeData() {
    return request.get("/api/roominfo/index")
}


//获取子节点
export  function getChild(nodeId, type, param) {

	return request({
		url: '/api/roominfo/getChild/'+nodeId+'/'+type,
		method: 'get',
		params: param
	})
}
//获取子节点统计信息
export  function getStatistics(nodeId, type) {
    return request.get("/api/roominfo/getStatistics/"+nodeId+"/"+type)
}
//查询项目
export function search(projectName) {
    return request({
        url: '/api/roominfo/searchProject',
        method: 'get',
        params: {projectName: projectName}
    })
    // return request.get("/api/roominfo/searchProject/"+projectName)
}

//构建单元列表
export function buildBuildingUnit(buildingId) {
    return request.get("/api/roominfo/buildBuildingUnit/"+ buildingId)
}

//验证物业编号是否重复
export function validateRoomCode(param){
    return request({
        url: '/api/roominfo/validateRoomCode',
        method: 'get',
        params: param
    })
}
//验证物业名称是否重复
export function validateRoomName(param){
    return request({
        url: '/api/roominfo/validateRoomName',
        method: 'get',
        params: param
    })
}

export function validateMerge(param){
    return request({
        url: '/api/roominfo/validateMerge',
        method: 'get',
        params: param
    })
}

export function save(data){
    return request.post('/api/roominfo', data)
}

export function edit(data) {
    return request.put('/api/roominfo', data)
}
/*资产处置*/
export  function doDeal(data) {
    return request.post('/api/roominfo/dealRoom', data)
}
/*资产删除*/
export  function doDelete(data) {
    return request.post('/api/roominfo/delete', data)
}

/**
 * 拆分资产
 * @param data
 * @returns {*}
 */
export  function doSplit(data) {
    return request.post('/api/roominfo/splitRoom', data)
}
/**
 * 合并资产
 * @param data
 * @returns {*}
 */
export  function doMerge(data) {
    return request.post('/api/roominfo/mergeRoom', data)
}

export function getLandInfo(type,id){
    return request({
        url: '/api/landinfo/getByProjectId/'+ type + '/' + id,
        method: 'get'
    })
}

export function uploadContractFile(obj) {
    return request({
        url: '/admin/sys-file/upload',
        method: 'post',
        data:obj
    })
}
//批量导入
export function doImport(data) {
    return request({
        url: '/api/roomimport/doImport',
        method: 'post',
        data: data
    })
}

//物业名称修改提醒
export function updateWarning(param){
	return request({
		url: '/api/roominfo/updateWarning',
		method: 'get',
		params: param
	})
}
